
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module thing</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>thing</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/media/sf_svns/occams/trunk/knife/thing.py">/media/sf_svns/occams/trunk/knife/thing.py</a></font></td></tr></table>
    <p><tt>Code&nbsp;to&nbsp;store&nbsp;knowledge&nbsp;about&nbsp;'things',&nbsp;i.e.&nbsp;'<a href="#Num">Num</a>'&nbsp;or&nbsp;'<a href="#Sym">Sym</a>'&nbsp;(for<br>
numbers&nbsp;and&nbsp;symbols,&nbsp;respectively).<br>
&nbsp;<br>
The&nbsp;main&nbsp;magic&nbsp;here&nbsp;is&nbsp;the&nbsp;'keep'&nbsp;function&nbsp;that&nbsp;accepts&nbsp;a&nbsp;new<br>
thing&nbsp;and&nbsp;updates&nbsp;our&nbsp;knowledge&nbsp;of&nbsp;this&nbsp;thing.<br>
&nbsp;<br>
After&nbsp;'keeping'&nbsp;many&nbsp;'things',&nbsp;these&nbsp;classes&nbsp;become&nbsp;the&nbsp;working&nbsp;<br>
memory&nbsp;of&nbsp;data&nbsp;seen&nbsp;in&nbsp;a&nbsp;particular&nbsp;context.<br>
&nbsp;<br>
This&nbsp;code&nbsp;is&nbsp;part&nbsp;of&nbsp;KNIFE:&nbsp;cropping&nbsp;complexity,&nbsp;culling&nbsp;confusion,&nbsp;<br>
and&nbsp;cutting&nbsp;the&nbsp;crap&nbsp;since&nbsp;2012<br>
&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.----------------._________________<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|=()=========---&nbsp;&nbsp;\-----------&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`\&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jgs&nbsp;&nbsp;\_________________/^^^^^^^^^^^^^^^^^^<br>
&nbsp;<br>
(c)&nbsp;2012,&nbsp;Tim&nbsp;Menzies,&nbsp;tim@menzies.us,&nbsp;LGPL&nbsp;v3.0</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="math.html">math</a><br>
</td><td width="25%" valign=top><a href="re.html">re</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="thing.html#Num">Num</a>
</font></dt><dt><font face="helvetica, arial"><a href="thing.html#Sym">Sym</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Num">class <strong>Num</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Num-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>'Max'&nbsp;and&nbsp;'min'&nbsp;are&nbsp;set&nbsp;to&nbsp;impossibe&nbsp;values&nbsp;so<br>
that&nbsp;the&nbsp;first&nbsp;time&nbsp;we&nbsp;'keep'&nbsp;anything,&nbsp;they&nbsp;get<br>
reset.&nbsp;'Sum'&nbsp;and&nbsp;'sumSq'&nbsp;are&nbsp;used&nbsp;to&nbsp;compute&nbsp;std.&nbsp;<br>
deviation</tt></dd></dl>

<dl><dt><a name="Num-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Prety&nbsp;printing.</tt></dd></dl>

<dl><dt><a name="Num-expected"><strong>expected</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;mean&nbsp;of&nbsp;this&nbsp;sample.</tt></dd></dl>

<dl><dt><a name="Num-keep"><strong>keep</strong></a>(self, n)</dt><dd><tt>Update&nbsp;our&nbsp;summary&nbsp;of&nbsp;the&nbsp;'n'&nbsp;numbers&nbsp;seen&nbsp;so&nbsp;far.<br>
Returns&nbsp;'n'&nbsp;coerced&nbsp;to&nbsp;its&nbsp;right&nbsp;type&nbsp;(if&nbsp;needed).</tt></dd></dl>

<dl><dt><a name="Num-mean"><strong>mean</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;mean&nbsp;of&nbsp;the&nbsp;sample.</tt></dd></dl>

<dl><dt><a name="Num-norm"><strong>norm</strong></a>(self, n)</dt><dd><tt>Normalizes&nbsp;a&nbsp;number&nbsp;'n'&nbsp;to&nbsp;0..1,&nbsp;for&nbsp;'min'&nbsp;to&nbsp;'max'.</tt></dd></dl>

<dl><dt><a name="Num-stdev"><strong>stdev</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;standard&nbsp;deviation&nbsp;of&nbsp;the&nbsp;sample.</tt></dd></dl>

<dl><dt><a name="Num-wiggle"><strong>wiggle</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;standard&nbsp;deviation&nbsp;of&nbsp;this&nbsp;sample.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Sym">class <strong>Sym</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Sym-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>The&nbsp;counts&nbsp;of&nbsp;what&nbsp;symbols&nbsp;seen&nbsp;so&nbsp;far&nbsp;is&nbsp;stored&nbsp;in&nbsp;'counts'.<br>
The&nbsp;most&nbsp;frequent&nbsp;symbol&nbsp;is&nbsp;the&nbsp;'mode',&nbsp;which&nbsp;has&nbsp;been&nbsp;seen&nbsp;<br>
'most'&nbsp;number&nbsp;of&nbsp;times.</tt></dd></dl>

<dl><dt><a name="Sym-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Pretty&nbsp;print.</tt></dd></dl>

<dl><dt><a name="Sym-entropy"><strong>entropy</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;entropy&nbsp;of&nbsp;the&nbsp;sample.</tt></dd></dl>

<dl><dt><a name="Sym-expected"><strong>expected</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;mode&nbsp;of&nbsp;this&nbsp;sample.</tt></dd></dl>

<dl><dt><a name="Sym-keep"><strong>keep</strong></a>(self, n)</dt><dd><tt>Updates&nbsp;our&nbsp;summary&nbsp;of&nbsp;the&nbsp;'n'&nbsp;symbols&nbsp;seen&nbsp;so&nbsp;far.<br>
Returns&nbsp;'n'.</tt></dd></dl>

<dl><dt><a name="Sym-wiggle"><strong>wiggle</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;entropy&nbsp;of&nbsp;this&nbsp;sample.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table>
</body></html>